Aarzoo Goel's other Models Reports

Major Concepts

 

Sign-Up/Login to access Several ML Models and also Deploy & Monetize your own ML solutions for free

Models Home » Domain Usecases » Health Care and Pharmaceuticals » Brain tumor Image Classification

Brain tumor Image Classification

Models Status

Model Overview

Brain Tumor Image Classification


Problem Statement:

The brain tumor is proved as a life-threatening disease that can even cause death. Various techniques have been identified for Brain MRI. Manual interpretation of a large number of images is very time-consuming and difficult. Hence, computer-based detection helps with accurate and fast diagnosis. Here, we propose that using deep learning Image Classification or transfer learning techniques would be helpful to doctors worldwide.
There are a lot of irregularity in the sizes and location of the brain tumor. Which makes it really difficult for understanding the nature of the tumor. Also, a professional Neurosurgeon is required for MRI analysis. In developing countries due the lack of skilful doctors and lack of knowledge about tumors makes it really difficult and time-consuming to generate reports from Scans.
Using EfficientNetBO model we got an accuracy of 93% and can improve it if we get more data for our model.
This observation aims to identify the type of tumor from the images or the patient has a tumor or not.


About the data:
The dataset I used here is downloaded from Kaggle. It includes four types of tumor images i.e. ‘Glioma Tumor', 'Meningioma Tumor', 'No Tumor', 'Pituitary Tumor'. There are around 3000 images in total.


 


Data Description

The original link for dataset is:
https://figshare.com/articles/dataset/brain_tumor_dataset/1512427


Downloaded from Kaggle link is:
https://www.kaggle.com/sartajbhuvaji/brain-tumor-classification-mri ,


Class: Glioma Tumor (795), Meningioma Tumor (800), No Tumor (363), Pituitary Tumor (795)

Training Dataset
Found 2753 images belonging to 4 classes.

Testing Dataset
Found 354 images belonging to 4 classes.

Model
EfficientNetB0

Accuracy
Validation Accuracy: 92% (We will take this as approximate accuracy and model can be more accurate in further studies with more data.)


F1-Score
0.92


Recall
0.84


Support 
81


Precision
0.94


Data Preprocessing:


1.Firstly, store all the different types of images in one list and also their label name.


2.Resize the image to 224*224

3.Convert labels name to integer and then categorical using one-hot encoding.


Image Augmentation:

Image augmentation is a technique of applying different transformations on original images, which results in multiple transformed copies of the same data. Each document, however, is different from the other in certain aspects depending on the augmentation techniques you apply, like shifting, rotating, flipping, etc.


Modeling:

I have used two models here ResNet50 and EfficientNetB0 but got more accuracy in EfficientNetB0. ResNet gave accuracy of only 85% and in EfficientNet got accuracy of 92%.


RestNet50:

ResNet50 is a Residual Network model which has 48 Convolution layers along with 1 MaxPool and 1 Average Pool layer. It is a mostly used ResNet model, and we have explored ResNet50 architecture in deep.


Residual Network is a classic neural network used as a backbone for many computer vision tasks. The ResNet has allowed us to train intense neural networks with 150+layers successfully. ResNet training was complex due to the problem of vanishing gradients.The reference link for the model is:


Detailed Guide to Understand and Implement ResNets – CV-Tricks.com


EfficientNetB0:


Transfer learning is usually done for tasks where your dataset has too little data to train a full-scale model from scratch. The effectiveness of model scaling also relies heavily on the baseline network. So, to further improve performance, we have also developed a new baseline network by performing a neural architecture search using the AutoML framework, which optimizes both accuracy and efficiency. We then scale up the baseline network to obtain a family of model, called EfficientNet.


We have compared our EfficientNets with other existing CNNs on ImageNet. In general, the EfficientNet models achieve higher accuracy and better efficiency over existing CNNs, reducing parameter size.
This function returns a Keras image classification model, optionally loaded with weights pre-trained on ImageNet.When the model is implemented for transfer learning, the Keras implementation can remove the top layers.

Some Code Snippet:

Load the data:


from google.colab import drive
drive.mount('/content/gdrive')

data = "Brain-Tumor-Classification-DataSet-master/Training"

folders=os.listdir(data)
print ("classes : ", folders)

Resize Image:

ImageSize= 224

#resize tumor scans
Scans=[cv2.resize(image, (ImageSize,ImageSize)) for image in Scans]
Scans = np.array(Scans)


Image Augmentation:

Image Augmentation techniques with Keras ImageDataGenerator



  • Rotations: Most common used augmentation technique is image Rotation. Even if we rotate the image, the information on the image remains the same. 



  • Shifts: By shifting the image, we change the position of the object in a image which gives more variety to the model. 



  • Flips: Flipping can be considered as an extension of rotation. It allows us to flip the image in the Left-Right direction and the Up-Down direction. 



  • Brightness: The brightness of the image can be augmented by either randomly darkening images, brightening images, or both 



  • Zoom: A zoom augmentation randomly zooms the image in and either adds new pixel values around the image. The zoom is uniformly randomly sampled from the zoom region for each dimension (width, height) separately.



from tensorflow.keras.preprocessing.image import ImageDataGenerator

batch_size = 24
datagen = ImageDataGenerator(
rotation_range=30,
width_shift_range=0.1,
height_shift_range=0.1,
zoom_range=0.5,
horizontal_flip=True)


Implement Model:

effnet = EfficientNetB0(weights='imagenet',include_top=False,input_shape=(ImageSize,ImageSize,3))
 


Global Average Pooling2D: Global Average pooling (GAP) layers is used to minimize the overfitting by reducing the total number of parameters from the model. Similar to max-pooling layers, GAP layers are used to reduce the spatial dimensions of a three-dimensional tensor.


Dropout: Dropout regularization is a way to regularize a deep neural network.Dropout works by removing or dropping out inputs to a layer, which may be input variables in the data sample or activations from a previous layer. 


Dense: Dense layer is the deeply connected neural network layer. It is mostly used common layer. Dense layer does the operation on the input and return the output. output = activation (dot (input, kernel) + bias)

model = effnet.output
model = tf.keras.layers.GlobalAveragePooling2D()(model)
model = tf.keras.layers.Dropout(rate=0.5)(model)
model = tf.keras.layers.Dense(4,activation='softmax')(model)
model = tf.keras.models.Model(inputs=effnet.input, outputs = model) 


Categorical Crossentropy:

Categorical cross-entropy is a loss function that is used in multi-class classification use case. These are use cases where an example can only belong to one out of many possible categories, and the model must decide which one. 


Adam Optimizer:

Adam(Adaptive Moment Estimation) is an optimization algorithm that can be used instead of the classical stochastic gradient descent procedure to update network weights iterative based on training data.Adam works with momentums of first and second order. The intuition behind the Adam is that we don’t want to roll so fast just because we can jump over the minimum, we want to decrease the velocity a little bit for a careful search.

model.compile(loss='categorical_crossentropy',
optimizer = 'Adam', metrics= ['accuracy'])


0 comments